<?php

namespace app\index\controller;

use app\admin\model\GuestBook;

class Message extends Base
{

    public function index()
    {
        return $this->view->fetch();
    }

    public function add()
    {
        $postData = input('post.');
        $validate = new \app\index\validate\Message();
        if ($validate->Check($postData)) {
            $message = GuestBook::create($postData);
            if ($message)
                $this->success('提交成功', 'message/index');
            $this->error('提交失败', 'message/index');
        } else {
            $this->error($validate->getError());
        }
    }

}
